package values.tech
{
import flash.errors.IllegalOperationError;
import flash.utils.Dictionary;

/**
 * TechTemplateValueList
 * @author jliang
 *
 */
public class TechTemplateValueList
{
	private static var _techs:Dictionary = new Dictionary(true); /* TechTemplateValue */
	
	public function get techs():Dictionary
	{
		return _techs;
	}
	
	[Data(type="mapping", 
			   mapping="tech", 
			   ref="values.tech.TechTemplateValue",
			   way="one_to_more",
			   object="flash.utils.Dictionary",
	           key="@key")]
	public function set techs(value:Dictionary):void
	{
		_techs = value;
	}
	
	public static function get techList():Dictionary
	{
		return _techs;
	}
	
	public static function getByKey(key:String):TechTemplateValue
	{
		var tech:TechTemplateValue = techList[key];
		if (!tech)
		{
			throw new IllegalOperationError("Cannot find <" + key + "> TechTemplateValue. Please check data configuration.");
		}
		return tech;
	}
}
}